<?php

namespace CMBUBank\UBank\Response\TransManager;

use CMBUBank\Http\Response;
use CMBUBank\UBank\Response\UBankBaseResponse;

class TransManagerSubunitQueryInfoResponse extends UBankBaseResponse
{
    protected $responseCode = ['ntduminfz1'];

    /**
     * 操作类型
     * @var  $optType
     */
    protected $optType;

    protected $isFinish;

    protected $bussInfo;

    protected function format(): Response
    {
        parent::formatLimit1();

        $this->bussInfo = $this->getBody()['response']['body']['ntoprdpxz1'][0];

        return $this;
    }

    public function checkFinish()
    {
        $this->requestStatus = $this->get('reqsta');

        if (!in_array($this->requestStatus, ['FIN', 'BNK', 'NPD', 'NTE'])) {
            $this->isFinish = false;
            return;
        }

        $this->isFinish = true;
    }

    public function getIsFinish()
    {
        return $this->isFinish;
    }

    public function getOptType()
    {
        $this->optType = $this->get('oprtyp','');

        return  $this->optType;
    }


    public function getResultInfo() {
        return $this->bussList;
    }

    public function getBussInfo()
    {
        return $this->bussInfo;
    }
}